package com.meiborte.controller;

import com.meiborte.entity.Result;
import com.meiborte.entity.User;
import com.meiborte.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/user")
public class UserController {
    @Resource
    private UserService userService;

    /**
     * 用户登录接口
     * @param user 用户信息
     * @return Result
     */
    @PostMapping(value = "/login")
    @ResponseBody
    public Result login(@RequestBody User user) {
        return userService.login(user);
    }

    /**
     * 用户注册接口
     * @param user 用户信息
     * @return Result
     */
    @PostMapping(value = "/register")
    @ResponseBody
    public Result register(@RequestBody User user) {
        return userService.register(user);
    }
}